using System.Collections;
using UnityEngine;

public class PlayerState_释放蓄力 : PlayerStateBase
{
	private Coroutine _Cor_动作中向前力;

	private ItemSO_Data_Player招式_系数 _Data_Player招式_系数_0;

	private ItemSO_Data_Player招式_系数 _Data_Player招式_系数_1;

	private ItemSO_Data_Player招式_系数 _Data_Player招式_系数_2;

	private ItemSO_Data_Player招式_系数 _Data_Player招式_系数_3;

	public PlayerState_释放蓄力()
	{
		_Data_Player招式_系数_0 = MonoSingleton<MyDataManager>.Instance._Data_玩家招式._重击_劈棍_0;
		_Data_Player招式_系数_1 = MonoSingleton<MyDataManager>.Instance._Data_玩家招式._重击_劈棍_1;
		_Data_Player招式_系数_2 = MonoSingleton<MyDataManager>.Instance._Data_玩家招式._重击_劈棍_2;
		_Data_Player招式_系数_3 = MonoSingleton<MyDataManager>.Instance._Data_玩家招式._重击_劈棍_3;
	}

	public override void OnEnter()
	{
		if (_Cor_动作中向前力 != null)
		{
			_Mono.StopCoroutine(_Cor_动作中向前力);
		}
		MonoSingleton<AudioManager>.Instance.F_Play_SFX(_Mono._AudioC_蓄力时);
		_Cor_动作中向前力 = _Mono.StartCoroutine(Cor_动作中向前力());
		_Mono._Ani.Play("蓄力攻击");
		_Timer = _Mono._Dict_AniName_time["蓄力攻击"];
		_NextState = StateType_Player.正常移动;
		_Mono._释放蓄力状态 = true;
		_Mono._C_攻击判断._击退力度 = 15f;
		if (_Mono._释放豆子 == 1)
		{
			_Data_Player招式_系数 = _Data_Player招式_系数_1;
		}
		else if (_Mono._释放豆子 == 2)
		{
			_Data_Player招式_系数 = _Data_Player招式_系数_2;
		}
		else if (_Mono._释放豆子 == 3)
		{
			_Data_Player招式_系数 = _Data_Player招式_系数_3;
		}
		else
		{
			_Data_Player招式_系数 = _Data_Player招式_系数_0;
		}
		F_创建攻击命中回调();
	}

	public override void F_攻击命中回调()
	{
		if (_Mono._释放豆子 == 1)
		{
			GameSceneController.F_屏幕震动(0.7f, 0.08f, 13);
		}
		else if (_Mono._释放豆子 == 2)
		{
			GameSceneController.F_屏幕震动(0.8f, 0.1f, 14);
		}
		else if (_Mono._释放豆子 == 3)
		{
			GameSceneController.F_屏幕震动(0.9f, 0.12f, 15);
		}
		else
		{
			GameSceneController.F_屏幕震动(0.6f, 0.06f, 12);
		}
	}

	public override void OnExit()
	{
		_Mono._C_攻击判断._攻击命中回调 -= F_攻击命中回调;
		_Mono._释放蓄力状态 = false;
		_Mono._GO_蓄力特效.SetActive(value: false);
		if (_Cor_动作中向前力 != null)
		{
			_Mono.StopCoroutine(_Cor_动作中向前力);
			_Cor_动作中向前力 = null;
		}
	}

	public override void OnUpdate()
	{
		base.OnUpdate();
	}

	private IEnumerator Cor_动作中向前力()
	{
		_Mono._Rb2D.velocity = Vector2.zero;
		_Mono._Rb2D.AddForce(new Vector2((_Mono._朝向右边 ? 1 : (-1)) * 60, 0f), ForceMode2D.Impulse);
		yield return new WaitForSeconds(0.4f);
		_Mono._Rb2D.AddForce(new Vector2((_Mono._朝向右边 ? 1 : (-1)) * 40, 0f), ForceMode2D.Impulse);
		yield return new WaitForSeconds(0.35f);
		_Mono._Rb2D.AddForce(new Vector2((_Mono._朝向右边 ? 1 : (-1)) * 80, 0f), ForceMode2D.Impulse);
	}
}
